/**
 * 表单form默认配置
 * node:节点类型，对应着template/里面组件的后缀，也是根据这个类型进行渲染
 * value:表单组件默认值
 * type:vant表单组件原生类型type
 * name:vant表单组件原生name，最后返回数据Object以name为key，可得到返回的数据
 * label:vant表单组件原生label，左侧显示的文字
 * placeholder:vant表单原生placeholder
 * rule:vant表单组件原生rules
 *
 * 目前暂时扩展出组件
 * 普通表单      text
 * select      select
 * 复选框       checkbox
 * 单选框       radio
 * 日历(单选，多选，选择某个范围)         canlendar
 * 评分         rate
 * 滑块         slider
 * 文件上传（单文件，多文件） filepload
 * 步进器    step
 * 开关   switch
 *
 * 暂时支持基本工能， 其他请自行扩展
 *
 * 企业详情表单默认配置
 */
import { filterDate } from "../../../util/date";
let enterpriseInfoForm = (config = {}) => {
  return [
    {
      node: "id",
      value: config.corpId || "",
      type: "text",
      name: "corpId",
      label: "",
      display: false,
      placeholder: ""
    },
    {
      node: "text",
      value: config.corpName || "",
      type: "text",
      name: "corpName",
      label: "公司名称",
      placeholder: "公司名称",
      rules: [
        {
          required: true,
          message: "请填写公司名称"
        }
      ]
    },
    {
      node: "text",
      value: config.taxNo || "",
      type: "text",
      name: "taxNo",
      label: "纳税人识别号",
      placeholder: "纳税人识别号",
      rules: [
        {
          required: true,
          message: "请填写纳税人识别号"
        }
      ]
    },

    {
      node: "select",
      value: config.taxType || "1",
      valueText: config.taxTypeText || "一般纳税人",
      type: "text",
      name: "taxType",
      label: "纳税人类型",
      columns: [
        {
          type: "1",
          text: "一般纳税人"
        },
        {
          type: "2",
          text: "小规模"
        }
      ],
      placeholder: "小规模"
    },
    {
      node: "text",
      value: config.businessAddr || "",
      type: "text",
      name: "businessAddr",
      label: "营业地址",
      placeholder: "营业地址",
      rules: [
        {
          required: true,
          message: "请填写营业地址"
        }
      ]
    },

    {
      node: "text",
      value: config.postAddr || "",
      type: "text",
      name: "postAddr",
      label: "邮寄地址",
      placeholder: "邮寄地址",
      rules: [
        {
          required: true,
          message: "请填写邮寄地址"
        }
      ]
    },
    {
      node: "text",
      value: config.contacter || "",
      type: "text",
      name: "contacter",
      label: "联系人姓名",
      placeholder: "联系人姓名",
      rules: [
        {
          required: true,
          message: "请填写联系人姓名"
        }
      ]
    },
    {
      node: "text",
      value: config.contactPhone || "",
      type: "text",
      name: "contactPhone",
      label: "联系人手机号",
      placeholder: "联系人手机号",
      rules: [
        {
          required: true,
          message: "请填写联系人手机号"
        }
      ]
    },
    {
      node: "text",
      value: config.bankAccount || "",
      type: "text",
      name: "bankAccount",
      label: "银行账号",
      placeholder: "银行账号",
      rules: [
        {
          required: true,
          message: "银行账号"
        }
      ]
    },
    {
      node: "text",
      value: config.bankName || "",
      type: "text",
      name: "bankName",
      label: "开户银行",
      placeholder: "开户银行",
      rules: [
        {
          required: true,
          message: "请填写开户银行"
        }
      ]
    },
    {
      node: "text",
      value: config.postSjhm || "",
      type: "text",
      name: "postSjhm",
      label: "开票邮递联系人手机号码",
      placeholder: "开票邮递联系人手机号码",
      rules: [
        {
          required: true,
          message: "请填写开票邮递联系人手机号码"
        }
      ]
    },
    {
      node: "text",
      value: config.postXm || "",
      type: "text",
      name: "postXm",
      label: "开票邮递联系人姓名",
      placeholder: "开票邮递联系人姓名",
      inputAlign:'right',
      rules: [
        {
          required: true,
          message: "请填写开票邮递联系人姓名"
        }
      ]
    },
    {
      node: "text",
      value: config.tjrSjhm || "",
      type: "text",
      name: "tjrSjhm",
      label: "推荐人手机号",
      placeholder: "推荐人手机号",
      rules: [
        {
          required: false,
          message: "请填写推荐人手机号"
        }
      ]
    }
  ];
};
/**
 * 企业用车表单默认配置
 */
let enterpriseCarForm = (config = {}) => {
  return [
    {
      node: "id",
      value: config.carId || "",
      type: "text",
      name: "carId",
      label: "",
      display: false,
      placeholder: ""
    },
    {
      node: "text",
      value: config.carPlate || "",
      type: "text",
      name: "carPlate",
      label: "车牌号码",
      placeholder: "车牌号码",
      rules: [
        {
          required: true,
          message: "请填写车牌号码"
        }
      ]
    },

    {
      node: "text",
      value: config.ownerName || "",
      type: "text",
      name: "ownerName",
      label: "车主姓名",
      placeholder: "车主姓名",
      rules: [
        {
          required: true,
          message: "请填写车主姓名"
        }
      ]
    },
    {
      node: "text",
      value: config.czrXm || "",
      type: "text",
      name: "czrXm",
      label: "出租人姓名",
      placeholder: "出租人姓名",
      rules: [
        {
          required: true,
          message: "请填写出租人姓名"
        }
      ]
    },
    {
      node: "text",
      value: config.czrSjhm || "",
      type: "text",
      name: "czrSjhm",
      label: "手机号",
      placeholder: "手机号",
      rules: [
        {
          required: true,
          message: "请填写手机号"
        }
      ]
    },
    {
      node: "text",
      value: config.czrSfzh || "",
      type: "text",
      name: "czrSfzh",
      label: "身份证号",
      placeholder: "身份证号",
      rules: [
        {
          required: true,
          message: "请填写身份证号"
        }
      ]
    },
    {
      node: "text",
      value: config.czrYhzh || "",
      type: "text",
      name: "czrYhzh",
      label: "银行账号",
      placeholder: "银行账号",
      rules: [
        {
          required: true,
          message: "请填写银行账号"
        }
      ]
    },
    {
      node: "text",
      value: config.czrKhyh || "",
      type: "text",
      name: "czrKhyh",
      label: "开户银行",
      placeholder: "开户银行",
      rules: [
        {
          required: true,
          message: "请填写开户银行"
        }
      ]
    },
    {
      node: "text",
      value: config.czrKhyh || "",
      type: "text",
      name: "czrKhyh",
      label: "工作单位(全称)",
      placeholder: "工作单位(全称)",
      rules: [
        {
          required: true,
          message: "请填写工作单位"
        }
      ]
    },
    {
      node: "calendar",
      name: "czqx",
      value: filterDate(config.czqxQ) + "至" + filterDate(config.czqxZ) || "",
      label: "出租期限",
      placeholder: "出租期限",
      type: "range"
    },
    {
      node: "select",
      value: config.zjtc || "1000",
      valueText: config.zjtcText || "1000元",
      type: "text",
      name: "zjtc",
      label: "租金套餐",
      columns: [
        {
          type: "1000",
          text: "1000元"
        },
        {
          type: "2000",
          text: "2000元"
        }
      ],
      placeholder: "租金套餐"
    }
  ];
};
/**
 * 企业合同需要修改的数据
 */
let enterpriseContract = (config = {}) => {
  return [
    {
      node: "text",
      value: config.email || "",
      type: "text",
      name: "email",
      label: "电邮",
      placeholder: "电邮"
    },
    {
      node: "text",
      value: config.leaseYear || "",
      type: "number",
      name: "leaseYear",
      label: "租赁年限",
      placeholder: "租赁年限"
    },
    {
      node: "calendar",
      value: config.leaseTerm || "",
      type: "range",
      name: "leaseTerm",
      label: "租赁期限",
      placeholder: "请选择租赁期限"
    },
    {
      node: "text",
      value: config.carNum || "",
      type: "number",
      name: "carNum",
      label: "汽车数量",
      placeholder: "请填写汽车数量"
    },
    {
      node: "text",
      value: config.moneyToal || "",
      type: "number",
      name: "moneyTotal",
      label: "租金总额",
      placeholder: "请填写租金总额"
    },
    {
      node: "text",
      value: config.event1 || "",
      type: "text",
      name: "event1",
      label: "其他约定事项",
      placeholder: "请填写其他约定事项"
    },
    {
      node: "text",
      value: config.event2 || "",
      type: "text",
      name: "event2",
      label: "其他约定事项",
      placeholder: "请填写其他约定事项"
    }
  ];
};

export { enterpriseInfoForm, enterpriseCarForm, enterpriseContract };
